"""
@File    :   out.py
@Time    :   2024/04/24 23:14:19
@Author  :   Qrj
@Email   :   923207736@qq.com
@description   :   OAuth2授权码模式相关的pydantic序列化模型
"""

from pydantic import BaseModel, Field

from src.business.admin.system.oauth2.client.schemas.out import (
    Oauth2ClientCompleteOutSchema,
)
from src.business.admin.system.tenant.tenant.schemas.out import TenantCompleteOutSchema
from src.business.admin.system.user.schemas.out import UserCompleteOutSchema
from src.schemas.out import BaseOutSchemaConfigMixin


class AuthorizationCodeCompleteOutSchema(BaseModel, BaseOutSchemaConfigMixin):
    """OAuth2授权码模式授权码的完整的验证模型"""

    code: str = Field(default=..., description="授权码")
    state: str = Field(default=..., description="state信息")
    redirect_uri: str = Field(default=..., description="重定向uri")
    include_query_redirect_uri: str = Field(
        default=..., description="携带query参数的重定向uri"
    )
    tenant: TenantCompleteOutSchema = Field(default=..., description="租户信息")
    oauth2_client: Oauth2ClientCompleteOutSchema = Field(
        default=..., description="OAuth2客户端信息"
    )
    user: UserCompleteOutSchema = Field(default=..., description="用户信息")
    scopes: list[str] = Field(default_factory=list, description="授权范围")
